package com.lj.service.Impl;

import com.lj.mapper.PmanagerMapper;
import com.lj.mapper.StaffljMapper;
import com.lj.pojo.Pmanager;
import com.lj.pojo.Stafflj;
import com.lj.pojo.StaffljExample;
import com.lj.service.PmanagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PmanagerServiceImpl implements PmanagerService {
    @Autowired
    PmanagerMapper pmanagerMapper;
    @Autowired
    StaffljMapper staffljMapper;
    @Override
    public Pmanager select(String id) {
        return pmanagerMapper.selectPmanager(id);
    }

    @Override
    public int update(String managerPassword, String managerName, Byte managerAge, String managerSex, String managerPhone, String managerId) {
        return pmanagerMapper.updatePmanager(managerPassword,managerName,managerAge,managerSex,managerPhone,managerId);
    }

    @Override
    public List<Stafflj> selectStaff(String departmentName) {
        StaffljExample example=new StaffljExample();
        example.createCriteria().andDepartmentNameEqualTo(departmentName);
        List<Stafflj> staffljList=staffljMapper.selectByExample(example);
        return staffljList;
    }

    @Override
    public int insertStaff(Stafflj stafflj) {
        return staffljMapper.insert(stafflj);
    }

    @Override
    public int deleteStaff(String id) {
        return staffljMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Stafflj getById(String id) {
        return staffljMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(Stafflj stafflj) {
        return staffljMapper.updateByPrimaryKey(stafflj);
    }
}
